'use strict';

const Controller = require('egg').Controller;

class gradesController extends Controller {
  async addgrades () {
    const { ctx, app } = this;
    var grades = ctx.request.body;
    var params = [];
    params.push(grades.stuid);
    params.push(grades.mathG);
    params.push(grades.englishG);
    params.push(grades.chemistryG);
    const rs = await ctx.service.addservice.addgrades(params);
    ctx.body = rs;
  }
  async delgrades () {
    const { ctx, app } = this;
    var id = ctx.request.body.stuid;
    const rs = await ctx.service.delservice.delgrades(id);
    ctx.body = rs;
  }
  async updgrades () {
    const { ctx, app } = this;
    var grades = ctx.request.body;
    var params = [];
    params.push(grades.stuid);
    params.push(grades.mathG);
    params.push(grades.englishG);
    params.push(grades.chemistryG);
    const rs = await ctx.service.updservice.updgrades(params);
    ctx.body = rs;
  }
  async selgrades () {
    const { ctx, app } = this;
    var id = ctx.request.body.Stuid;
    const rs = await ctx.service.selservice.selgrades(id);
    ctx.body = rs;
  }
  async judgrades () {
    const { ctx, app } = this;
    var id = ctx.request.body.Stuid;
    const rs = await ctx.service.judservice.judgrades(id);
    ctx.body = rs;
  }
}

module.exports = gradesController;
